<?php

include("admin_lock.php");


if(!isset($_POST['loginName']) || !isset $_POST['password'] || !isset $_POST['firstName'] || !isset $_POST['middleName'] || !isset $_POST['lastName'] || !isset $_POST['department'] || !isset $_POST['email'])
{
	header("Location: admin_create_instructor.php?error=1");
	die();
}

require("config.php");

$loginName=$_POST['loginName'];
$password=$_POST['password'];
$fName=$_POST['firstName'];
$mName=$_POST['middleName'];
$lName=$_POST['lastName'];
$department=$_POST['department'];
$email=$_POST['email'];

$createStudentQuery="INSERT INTO Instructor (login,password,firstName,middleName,lastName,department,email) VALUES ($loginName,$password,$fname,$mName,$lName,$department,$email)";

$studentResult=mysql_query(addslashes($createStudentQuery));

if(!$studentResult)
{
	header("Location: createInstructor.php?error=1");
}
else
{
	header("Location: admin.php");
}

?>
